//
//  ChangePswVC.m
//  hnGovernment
//
//  Created by 安仔 on 17/3/7.
//  Copyright © 2017年 安仔. All rights reserved.
//

#import "ChangePswVC.h"
#import "SetUpPswView.h"
#import "DDbaseNetWork+Login.h"
#import "DDcacheManager.h"
#import "DDHudHelper.h"
@interface ChangePswVC ()<SetUpPswViewDelegate>
@property (nonatomic, strong) SetUpPswView *myView;
@end

@implementation ChangePswVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = NSLocalString(@"修改密码");
    
    self.myView = [[SetUpPswView alloc] initWithFrame:CGRectMake(0, 120 * m6Scale, KScreenWidth, 440 * m6Scale)];
    self.myView.firstTF.placeHolderString = NSLocalString(@"请输入原始密码");
    self.myView.secondTF.placeHolderString = NSLocalString(@"请输入新密码");
    self.myView.delegate = self;
    self.myView.isResetPassword = YES;
    [self.view addSubview:self.myView];
    

}

- (void)clickSureBtn {
    
    [SVProgressHUD showWithStatus:@"密码修改中"];
    [DDNetWorkManager userResetPasswordWithOldPassWord:self.myView.firstTF.text newPassWord:self.myView.secondTF.text token:[cacheManager userToken] controller:self success:^(id result, DDcacheType cacheType, DDresultType resultType) {
        [DDHudHelper showHudWithResult:result resultSuccess:^{
            [SVProgressHUD showSuccessWithStatus:NSLocalString(@"修改成功")];
            [self.navigationController popViewControllerAnimated:YES];
        }];
    } failure:^(NSError *error) {
    }];
}

@end
